<template>
  <div class="front-container">
    <!-- 英雄区域 -->
    <section class="hero-section">
      <div class="hero-content">
        <h1 class="hero-title">农产品融销一体平台</h1>
        <p class="hero-subtitle">连接农户与市场，促进农业可持续发展</p>
        <div class="hero-actions">
          <el-button type="primary" size="large" @click="exploreProducts">
            <i class="el-icon-shopping-bag-1"></i> 浏览商品
          </el-button>
          <el-button type="success" size="large" @click="learnMore">
            <i class="el-icon-reading"></i> 了解更多
          </el-button>
        </div>
      </div>
      <div class="hero-image">
        <img src="../../assets/img/hero-image.svg" alt="农产品融销平台" />
      </div>
    </section>

    <!-- 搜索区域 -->
    <section class="search-section">
      <div class="search-container">
        <h2 class="section-title">寻找您需要的农产品</h2>
        <Search></Search>
      </div>
    </section>

    <!-- 服务特点 -->
    <section class="features-section">
      <h2 class="section-title">我们的服务</h2>
      <div class="features-grid">
        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-shopping-cart-full"></i>
          </div>
          <h3 class="feature-title">直接采购</h3>
          <p class="feature-description">从农户直接采购新鲜农产品，减少中间环节，保证品质与价格</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-money"></i>
          </div>
          <h3 class="feature-title">融资支持</h3>
          <p class="feature-description">为农户提供便捷的融资渠道，解决资金困难，促进生产发展</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-user"></i>
          </div>
          <h3 class="feature-title">专家指导</h3>
          <p class="feature-description">专业农业专家在线解答，提供种植、养殖等方面的技术支持</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-connection"></i>
          </div>
          <h3 class="feature-title">智能匹配</h3>
          <p class="feature-description">基于需求智能匹配供需双方，提高交易效率，促进合作共赢</p>
        </div>
      </div>
    </section>

    <!-- 热销产品 -->
    <section class="hot-products-section">
      <h2 class="section-title">热销产品</h2>
      <HotSales></HotSales>
    </section>

    <!-- 关于我们 -->
    <section class="about-section">
      <AboutUs />
    </section>

    <!-- 页脚 -->
    <footer class="footer-section">
      <div class="footer-container">
        <div class="footer-column">
          <h3 class="footer-title">联系我们</h3>
          <p><i class="el-icon-location"></i> 地址:太原理工大学</p>
          <p><i class="el-icon-phone"></i> 电话: 15778364887</p>
          <p><i class="el-icon-message"></i> 邮箱: 12345678@qq.com</p>
        </div>
        <div class="footer-column">
          <h3 class="footer-title">快速链接</h3>
          <ul class="footer-links">
            <li><a href="#" @click.prevent="frontBtn">首页</a></li>
            <li><a href="#" @click.prevent="goodsBtn">商品货源</a></li>
            <li><a href="#" @click.prevent="purchaseBtn">求购需求</a></li>
            <li><a href="#" @click.prevent="knowledgesBtn">农业知识</a></li>
          </ul>
        </div>
        <div class="footer-column">
          <h3 class="footer-title">关注我们</h3>
          <div class="social-links">
            <a href="#" class="social-link"><i class="el-icon-s-platform"></i></a>
            <a href="#" class="social-link"><i class="el-icon-s-marketing"></i></a>
            <a href="#" class="social-link"><i class="el-icon-s-cooperation"></i></a>
            <a href="#" class="social-link"><i class="el-icon-s-promotion"></i></a>
          </div>
        </div>
      </div>
      <div class="footer-bottom">
        <p>© 2025 农产品融销一体平台. 保留所有权利.</p>
      </div>
    </footer>
  </div>
</template>

<script>
import OurService from "./OurService";
import HotSales from "./HotSales";
import Search from "./Search";
import Carousel from "./Carousel";
import AboutUs from "./AboutUs";

export default {
  components: {
    Carousel,
    OurService,
    HotSales,
    Search,
    AboutUs
  },
  methods: {
    exploreProducts() {
      this.$router.push("/home/goods").catch(err => err);
    },
    learnMore() {
      this.$router.push("/home/knowledge").catch(err => err);
    },
    frontBtn() {
      this.$router.push("/home/front").catch(err => err);
    },
    goodsBtn() {
      this.$router.push("/home/goods").catch(err => err);
    },
    purchaseBtn() {
      this.$router.push("/home/purchase").catch(err => err);
    },
    knowledgesBtn() {
      this.$router.push("/home/knowledge").catch(err => err);
    }
  }
};
</script>

<style lang="less" scoped>
.front-container {
  min-height: 100vh;
  background-color: var(--background-dark);
  color: var(--text-primary);
}

// 通用样式
.section-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
  position: relative;
  color: var(--text-primary);
  
  &:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
  }
}

// 英雄区域
.hero-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  
  .hero-content {
    flex: 1;
    padding-right: 2rem;
    
    .hero-title {
      font-size: 3rem;
      font-weight: 700;
      margin-bottom: 1rem;
      color: var(--primary-color);
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .hero-subtitle {
      font-size: 1.5rem;
      color: var(--text-secondary);
      margin-bottom: 2rem;
      font-weight: 500;
    }
    
    .hero-actions {
      display: flex;
      gap: 1rem;
      
      .el-button {
        padding: 12px 24px;
        font-size: 1rem;
        font-weight: 600;
      }
    }
  }
  
  .hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    
    img {
      max-width: 100%;
      height: auto;
      animation: float 6s ease-in-out infinite;
      filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
    }
  }
}

// 搜索区域
.search-section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  
  .search-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }
  
  .search-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    font-weight: 500;
  }
  
  .search-container {
    display: flex;
    max-width: 800px;
    margin: 0 auto;
    
    .el-input {
      flex: 1;
      
      .el-input__inner {
        height: 50px;
        border-radius: 8px 0 0 8px;
        border: 2px solid var(--primary-color);
        background-color: var(--background-light);
        color: var(--text-primary);
        font-size: 1rem;
        padding-left: 1.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        
        &:focus {
          border-color: var(--accent-color);
          box-shadow: 0 0 0 3px rgba(74, 255, 140, 0.3);
        }
        
        &::placeholder {
          color: var(--text-secondary);
          opacity: 0.7;
        }
      }
    }
    
    .el-button {
      height: 50px;
      border-radius: 0 8px 8px 0;
      background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
      border: none;
      font-size: 1rem;
      font-weight: 600;
      padding: 0 2rem;
      color: white;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      transition: all 0.3s ease;
      
      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
        background: linear-gradient(135deg, var(--primary-color-light), var(--secondary-color-light));
      }
      
      i {
        margin-right: 8px;
      }
    }
  }
  
  .search-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    gap: 0.5rem;
    
    .el-tag {
      cursor: pointer;
      padding: 8px 16px;
      font-size: 0.9rem;
      font-weight: 500;
      border-radius: 20px;
      background-color: rgba(124, 112, 255, 0.15);
      color: var(--primary-color);
      border: 1px solid var(--primary-color);
      transition: all 0.3s ease;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      
      &:hover {
        background-color: rgba(124, 112, 255, 0.3);
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      }
    }
  }
}

// 服务特点
.features-section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  
  .features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    
    .feature-card {
      background-color: var(--card-background);
      border-radius: 8px;
      padding: 2rem;
      text-align: center;
      transition: transform 0.3s ease, box-shadow 0.3s ease;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      
      &:hover {
        transform: translateY(-10px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
      }
      
      .feature-icon {
        font-size: 3rem;
        margin-bottom: 1.5rem;
        color: var(--primary-color);
        
        i {
          background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
          filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        }
      }
      
      .feature-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        color: var(--text-primary);
        font-weight: 600;
      }
      
      .feature-description {
        color: var(--text-secondary);
        line-height: 1.6;
        font-weight: 500;
      }
    }
  }
}

// 热销产品
.hot-products-section {
  padding: 4rem 2rem;
  background-color: var(--background-light);
  
  > div {
    max-width: 1200px;
    margin: 0 auto;
  }
}

// 关于我们
.about-section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

// 页脚
.footer-section {
  background-color: var(--background-light);
  padding: 3rem 2rem 1rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  
  .footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    
    .footer-column {
      flex: 1;
      min-width: 250px;
      margin-bottom: 2rem;
      
      .footer-title {
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 1.5rem;
        color: var(--text-primary);
        position: relative;
        
        &:after {
          content: '';
          position: absolute;
          bottom: -8px;
          left: 0;
          width: 40px;
          height: 2px;
          background: var(--primary-color);
        }
      }
      
      p {
        margin-bottom: 0.8rem;
        color: var(--text-secondary);
        font-weight: 500;
        
        i {
          margin-right: 8px;
          color: var(--primary-color);
        }
      }
      
      .footer-links {
        list-style: none;
        padding: 0;
        margin: 0;
        
        li {
          margin-bottom: 0.8rem;
          
          a {
            color: var(--text-secondary);
            text-decoration: none;
            transition: color 0.3s;
            font-weight: 500;
            
            &:hover {
              color: var(--primary-color);
              text-shadow: 0 0 8px rgba(124, 112, 255, 0.3);
            }
          }
        }
      }
      
      .social-links {
        display: flex;
        gap: 1rem;
        
        .social-link {
          display: flex;
          align-items: center;
          justify-content: center;
          width: 40px;
          height: 40px;
          border-radius: 50%;
          background-color: var(--card-background);
          color: var(--text-primary);
          transition: all 0.3s;
          
          &:hover {
            background-color: var(--primary-color);
            color: white;
            transform: translateY(-5px);
          }
        }
      }
    }
  }
  
  .footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
  }
}

// 动画
@keyframes float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0);
  }
}

// 响应式设计
@media screen and (max-width: 768px) {
  .hero-section {
    flex-direction: column;
    text-align: center;
    
    .hero-content {
      padding-right: 0;
      margin-bottom: 2rem;
      
      .hero-actions {
        justify-content: center;
      }
    }
  }
  
  .footer-container {
    flex-direction: column;
    
    .footer-column {
      margin-bottom: 2rem;
    }
  }
}
</style>
